//
//  MFSDKSplashAd.h
//  IMSDK_CHINA
//
//  Created by pillow on 2025/8/4.
//  Copyright © 2025 MFSDK. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN

@protocol MFSDKSplashAdDelegate;
@interface MFSDKSplashAd : NSObject


//初始化开屏广告
-(instancetype)initWithSlotID:(NSString *)slotID;

//可选，拉取广告超时时间，默认为不限制
@property (nonatomic,assign) double fetchDelay;
//必选，接收回调的代理
@property (nonatomic,weak) id<MFSDKSplashAdDelegate> delegate;

//如果开屏广告展示时要展示bottomView，必须在loadAdData前设置其高度，以确定穿山甲广告view的大小
@property (nonatomic,assign) int bottomViewHeight;

//返回广告是否可展示
//当广告已经加载完成&&未曝光&&未过期时，为YES，否则为NO
- (BOOL)isAdValid;

//设置广告平台，1是MFadx广告，2是广点通，4是穿山甲，5是快手，7是百度，9是Oct,10是倍孜，这个只是适配时，测试各个平台广告是否正常
//提审App Store前请删除这个方法的调用。（方法内有判断，线上模式不生效）
-(void)setAdPlat_test:(int)plat;

//开始请求广告
- (void)loadAdData;

//广告的eCPM，单位：分 默认返回0，如果需要真实的ecpm，请联系SDK运营或技术人员
//在mfsdk_splashAdDidLoad回调后可以调用
- (NSInteger)eCPM;

//展示广告  viewController用来presentViewController:animated:YES completion:展示广告控制器
//bottomView可选，如果有bottomView，需要设置好frame
- (void)showAdWithViewController:(UIViewController*)viewController bottomView:(UIView * _Nullable)bottomView;

@end


@protocol MFSDKSplashAdDelegate <NSObject>

@optional
//广告加载完成
- (void)mfsdk_splashAdDidLoad:(MFSDKSplashAd *)splashAd;

//广告加载失败
- (void)mfsdk_splashAd:(MFSDKSplashAd *)splashAd didFailWithError:(NSError *)error;

//广告曝光
- (void)mfsdk_splashAdExposured:(MFSDKSplashAd *)splashAd;

//广告被点击
- (void)mfsdk_splashAdDidClick:(MFSDKSplashAd *)splashAd;

//广告即将关闭  有的广告没有这个回调比如穿山甲
- (void)mfsdk_splashAdWillClose:(MFSDKSplashAd *)splashAd;

//广告已经关闭
- (void)mfsdk_splashAdDidClose:(MFSDKSplashAd *)splashAd;

//用户点击了跳过按钮
- (void)mfsdk_splashAdDidClickSkip:(MFSDKSplashAd *)splashAd;

@end

NS_ASSUME_NONNULL_END
